#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"


class NoiseCloudProcess : public RenderProcess
{
	DECLARE_PROCESS(NoiseCloudProcess)

	struct Ubo
	{
		glm::mat4 projView;       // Camera view * projection
		glm::mat4 viewInverse;    // Camera inverse view matrix
		glm::mat4 projInverse;    // Camera inverse projection matrix
		glm::vec3 lightPos;
		float baseScale;
		float lightScale;
		float finalScale;
		float noiseScale;
		uint32 frame;
		int32 debugIndex;
	};

public:

	int32 mDebugIndex;

	float mBaseScale;

	float mLightScale;

	float mFinalScale;

	float mNoiseScale;

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:

	LocalEntity* mLightEntity;

	RefCountPtr<RHIBuffer> mUboBuffer;

	RefCountPtr<RHITexture> mNoiseTexture;

	RefCountPtr<RHISampler> mCommonSampler;

	RefCountPtr<ColorRenderTarget> mColorRenderTarget;

	RefCountPtr<DepthRenderTarget> mDepthRenderTarget;

	RefCountPtr<RHIDescriptor> mDescriptor;

	DescriptorMask mDescriptorMask;

	RefCountPtr<GraphicsPipeline> mPipeline;

	RefCountPtr<RHIRenderPass> mRenderPass;

	RefCountPtr<RHIFrameBuffer> mFrameBuffer;

};
